package cc.yugu.yhdw.common.protocol.msg02;

import cc.yugu.yhdw.common.protocol.MsgCode;
import cc.yugu.yhdw.common.tool.netty.TypeOperator;
import io.netty.buffer.ByteBuf;

import java.util.ArrayList;
import java.util.List;

public class Msg022000027 extends Msg022 {
    public List<Customer> customerList = new ArrayList<Customer>();

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_022000027.getCode();
    }

    @Override
    public void writeData(ByteBuf buffer) {
        writeRtn(buffer);

        buffer.writeInt(customerList.size());
        for(Customer e : customerList) {
            e.write(buffer);
        }
    }

    public static class Customer extends TypeOperator {

        public int id;
        public String mobile;
        public String password;
        public int balance;
        public String batteryId;

        public void write(ByteBuf buffer) {
            buffer.writeInt(id);
            writeString(buffer,mobile);
            writeString(buffer,password);
            buffer.writeInt(balance);
            writeString(buffer,batteryId);
        }
    }
}
